﻿<%@ WebHandler Language="C#" Class="lists" %>
using Models;
using System;
using System.Web;
using Newtonsoft.Json;
using System.Linq;
using System.Collections.Generic;

public class lists : IHttpHandler {

    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";

        var code = 1;
        var msg = "获取成功";
        var time = DateTime.Now;

        using (Entities bll = new Entities())
        {

            var Bpl = bll.User.Select(x => new
            {
                id=x.UID,
                title=x.UNickName,
                type_name=x.Utype,
                createtime=x.RegTime,
                img=x.UHeadImg
            });//全部.ToList();



            var total =Bpl.Count();
            var per_page = 10;
            var current_page=1;
            var last_page=1;

            var data = new { total,per_page,current_page, last_page,data=Bpl};
            context.Response.Write(JsonConvert.SerializeObject(new { code,msg,time,data}));

        }

        HttpContext.Current.Response.End();
        //context.Response.Write("Hello World");


    }

    public bool IsReusable {
        get {
            return false;
        }
    }




}